<#import '/ftlLibrary/properteisVariable.ftl' as pv/>
<link href="assets/css/bootstrap-select.css" rel="stylesheet"/>
<script src="assets/js/select2/select2.js"></script>
<style>
    .bootbox-close-button {
        width: 19px;
        height: 19px;
        border: none;
        cursor: pointer;
        -webkit-appearance: none;
        float: right;
        top: 4px;
        left: -5px;
        position: relative;
        background: #E9F5FF url("assets/img/nav-img/icon_close.png") no-repeat 0 0;
    }

    .postponeList .modal-dialog {
        width: 60% !important;
    }

    .modal-content {
        width: 100%;
    }

    input, select, .form-control {
        height: 30px;
    }

    .myDialogDetail label {
        margin-bottom: 0px !important;
    }

    .detailDialogStyle {
        line-height: 30px;
        margin-bottom: 15px;
    }

    .myDialogDetail1 .modal-body {
        padding-bottom: 0px !important;
        border-bottom-right-radius: 5px !important;
        border-bottom-left-radius: 5px !important;
    }
</style>
<div class="row ">
    <!-- 映射列表 -->
    <div class="col-xs-12 col-sm-12 col-md-12 col-lg-12" id="leftTree">
        <div class="row" style="margin-bottom: 15px;margin-top:15px;font-size: 14px">
                    <span style="padding-left: 16px">
                        请选择报班所要延期的课时包
                    </span>
        </div>
        <div class="widget flat radius-bordered">
            <div class="widget-body no-padding" style="margin-top: 0;box-shadow:0px 0px 10px rgba(122,161,184,0.3);">
                <div class="table-scrollable" style="border: none;">
                    <!-- 数据表列信息列表 -->
                    <table class="table table-hover dataTable newtable">
                        <thead>
                        <tr>
                            <th title="会员课时包id">课时包名称</th>
                            <th title="剩余课时">剩余课时</th>
                            <th title="剩余有效期">剩余有效期</th>
                            <th title="延期次数">延期次数</th>
                            <th title="延期备注">延期备注</th>
                            <th class="fixedColumn">操作项</th>
                        </tr>
                        </thead>
                        <tbody>
                        <#if mapList?size==0>
                            <tr>
                                <td align="center">无数据</td>
                            </tr>
                        </#if>
                        <#list mapList as data>
                            <tr>
                                <td>${(data.name???string(data.name?html,"未设置"))!'未设置'}</td>
                                <td>${(data.surplusClassHour???string(data.surplusClassHour?html,"未设置"))!'未设置'}</td>
                                <td>${(data.surplusValidDate???string(data.surplusValidDate?html,"未设置"))!'未设置'}</td>
                                <td>${(data.postponeCount???string(data.postponeCount?html,"0"))!'0'}</td>
                                <td>${(data.remark???string(data.remark?html,"未设置"))!'未设置'}</td>
                                <td align="center">
                                    <a onclick="showDialogAddPostPhone(this)" serializeNum="${serializeNum}" packageStatus="${data.packageStatus}" postponeCount="${(data.postponeCount???string(data.postponeCount?html,'0'))!'0'}"
                                       editUrl="${editUrl}" targetDataId="${data.memberPackageId}">延期</a>
                                </td>
                            </tr>
                        </#list>
                        </tbody>
                    </table>
                </div>
            </div>
        </div>
    </div>
</div>
</div>
</div>
<script>
    $(".selectpicker").select2();

    function showDialogAddPostPhone(that) {
        var packStatus = $(that).attr("packageStatus");
        if(packStatus==1){
            var editUrl = $(that).attr("editUrl");
            var tartgetdateId = $(that).attr("targetDataId");
            var serializeNum = $(that).attr("serializeNum");
            var postponeCount = $(that).attr("postponeCount");
            ajaxRequest(editUrl, {
                serializeNum: serializeNum,
                tartgetdateId: tartgetdateId,
                postponeCount:postponeCount,
                type: 1
            }, function (html) {
                getTopWin().bootbox.dialog({
                    message: html,
                    title: "亲子延期",
                    className: 'myDialog adjournDialog'
                });
                $(".modal-header").find(".bootbox-close-button").removeClass("close");
                $(".modal-header").find(".bootbox-close-button").html("");
            }, function () {
                ajaxError("加载页面失败!")
            }, "get", "html")
        }else {
            logger.error("当前课时包不在使用中");
        }
    }

</script>